/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package group2assignone.ucm.manager;

import group2assignone.dao.MyDAO;
import group2assignone.model.Airport;
import group2assignone.ucm.UCController;
import group2assignone.ucm.UCStartup;
import group2assignone.view.manager.EditAirportView;
import group2assignone.view.manager.ManagerView;
import java.util.ArrayList;

/**
 * Use Case: Change UI to Manager Edit Airport View                         <br>
 * Pre-condition: Manager is logged in and clicks the 'edit airport' button.<br>
 * Post-condition: Available airports for edit view is displayed.           <br>
 * 1. system exits the current view                                         <br>
 * 2. system Retrieves a list of availalbe airports                         <br>
 * 3. system opens the new Edit Airport view                                <br>

 * @author group2
 */
public class UCUIEditAirport implements UCController
{

    ArrayList<Airport> airportList = new ArrayList<Airport>();

     /**
     * Use Case to show the 'Airport Edit' view
     */

    public void run()
    {
        //1. system exits the current view
        ManagerView mv = ManagerView.getInstance();
        mv.dispose();
        //2. system Retrieves a list of availalbe airports
        MyDAO coms = UCStartup.getInstance().getDAO();
        airportList = coms.sQLGetAirports();
        //3. system opens the new Edit Airport view
        EditAirportView view = new EditAirportView(airportList);
        view.go();
    }

}
